Jump to content

Wikipedia:Reference desk/Archives/Computing/2011 August 30

From Wikipedia, the free encyclopedia
Computing desk
< August 29 << Jul | August | Sep >> August 31 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


August 30

[edit]

Mozila reloading previous sessions

[edit]

So, I prefer using Mozilla as my web browser for various reasons. But one thing that drives me crazy is that, if I suddenly need to end a session, or if my browser closes unexpectedly (which happens often with this old work cpu I'm stuck with), when I try to open up the browser, it wants to "retrieve" my previous sessions...and I really don't need it to...and it often slows things down greatly, when I could just start a new session and manually reload my e-mail, or whatever I need. So, is there a way to stop it from constantly trying to "retrieve" my previous sessions? Quinn BEAUTIFUL DAY 00:05, 30 August 2011 (UTC)[reply]

Disabling crash recovery AvrillirvA (talk) 00:43, 30 August 2011 (UTC)[reply]

Editing .bashrc

[edit]

Okay so I am running Ubuntu 11.04 and I am trying to edit the .bashrc file so that if I open up a terminal window and type in matlab then MATLAB should run and if I type in mathematica, then Mathematica should run. I opened up the file and added at the end of the file the line

export PATH=$PATH:$Home/Mathematica/Executables:$HOME/MATLAB/bin

When I type in matlab, it opens up fine but for mathematica it says command not found. The location for mathematica is indeed $Home/Mathematica/Executables/mathematica because when I type this whole thing into the terminal, Mathematica opens up fine. I am not familiar with linux at all so I don't know what am I doing wrong. What is the right way to do this? Thanks!128.138.138.122 (talk) 01:21, 30 August 2011 (UTC)[reply]

You mean the file is $Home/Mathematica/Executables/mathematica.exe ? Perhaps $HOME wasn't properly defined and this command then propagated the problem ? Try "echo $HOME" before the command in .bashrc (you sure it isn't .bshrc, without the "a" ?), and "echo $PATH" after, to see if it's properly defined, then do the same in the bash window you opened. Also, are both commands performed in the same terminal window (and are you sure that's a bash window, not csh, or ksh) ? As for the one command working and the other not, it's possible one directory was added to the path elsewhere, say as a result of the installation of that program, and that your setting of the PATH variable isn't working at all. Also beware that there are other environment variables for things like libraries, which may also need to be set. StuRat (talk) 01:47, 30 August 2011 (UTC)[reply]
Minor points: it probably doesn't have .exe in the name on a Unix system. It certainly is .bashrc; however, the rules for bash's init files are relatively complicated and sometimes you want .bash_login or the environment variable $BASH_ENV. If the command isn't running at all, it may need to be moved. --Tardis (talk) 02:56, 30 August 2011 (UTC)[reply]
If you used that text literally, then your problem may be simply that you're using $Home instead of $HOME. --Tardis (talk) 02:56, 30 August 2011 (UTC)[reply]

Perfect Tardis, that's exactly what it was. Thanks128.138.138.122 (talk) 20:20, 30 August 2011 (UTC)[reply]

wikipedia mirror on my local network.

[edit]

Let's say I wanted to mirror the entire Wikipedia site, images and all, locally on my home network for private use. I know how to download the wikipedia database dumps and use them offline with various software packages, but these dumps don't include images. Furthermore, I want my mirror to be accessible through a web browser when I point it at a certain IP on my network.

So how would I go about doing this? 209.182.121.46 (talk) 07:40, 30 August 2011 (UTC)[reply]

To fully host the dump, you'd need an Apache server with php and the MediaWiki, which you set up and then restore the database into that. Wikipedia:Database download also lists some html based programs for reading them, but for maximum fidelity MediaWiki itself is probably the best solution. Because of the titanic size of the archive, image dumps are no longer made directly available - "Downloading images" on the meta wiki discusses two ways of retrieving them. As the overall size is more than 200 Gbytes, downloading a full archive is a serious undertaking. I'm not aware of a way to obtain a physical disk with all of them on it - to my mind it wouldn't be a bad idea if the Foundation gave (or sold at cost+) physical disks, with at least the entire free image set on it, to libraries and comparable archives. -- Finlay McWalterTalk 14:04, 30 August 2011 (UTC)[reply]
The article on mirroring Wikipedia is Wikipedia:Database download. It includes notes on getting images, and includes tips on setting up MediaWiki properly. Comet Tuttle (talk) 17:32, 30 August 2011 (UTC)[reply]

Deleting many files

[edit]

In a fit of almost Faustian curiosity, I decided to create a few 1-byte files in a temp directory. Where "a few" means about 9 million. The script for doing so, incidentally, is here. On my rather old Linux box (2.6.38, ext3) this is impressively speedy, creating about 5 million files per hour. So that's super then. Now all I have to do is to delete those files. rm wasn't making much impact (even to measure progress I had to write my own "ls|wc" program, which fyi is here). So I've written a custom remover, which does nothing more than a readdir/unlink loop - that's here. But its performance is much slower than creation (by a factor of 30 or so) meaning it'll take about 36 hours to delete all the files. My guess is that each unlink operation involves a seek between the directory inode and the file inode. So:

  1. Am I missing some obvious way to wholesale unlink the folder in question (and if necessary have fsck sort it out, surely in less time than 36 hours)? rmdir(2) won't work on a non-empty directory.
  2. I can't think of a better way to write the cleanup (it surely does what rm does); is there some obvious improvement to make?

Thanks. -- Finlay McWalterTalk 13:40, 30 August 2011 (UTC)[reply]

The speed of creating/deleting might depend on the number of files in the directory, 9 million is a lot, so it might get faster as more files get deleted. Hopefully... 93.95.251.162 (talk) 15:45, 30 August 2011 (UTC) Martin.[reply]

This doesn't answer your question and isn't helpful to your current situation, but you might find it useful or interesting; I've had similar problems deleting thousands of files on Windows 7. My solution is to use a virtual hard disk when writing loads of files. When you want to delete all the files, you just quick format the virtual hard disk or delete the .vhd file AvrillirvA (talk) 16:02, 30 August 2011 (UTC)[reply]

In hindsight, a loopback mount would have the same effect with less overhead than a VM. But yes, there's no syscall for hindsight. -- Finlay McWalterTalk 16:55, 30 August 2011 (UTC)[reply]
Using rm * won't work. The shell will try to batch up every filename before starting the delete process. If you happened to put them all in a specific directory (lets pretend it is tmp), then you can delete the directory with rm -Rf tmp. If you want the directory again (but empty), just follow that with mkdir tmp. -- kainaw 16:06, 30 August 2011 (UTC)[reply]
I was doing rm -f /tmp/f (where f is the directory containing the 9 million), so globbing and the shell isn't an issue. The discrepancy between the count and clean programs (3 minutes vs several days) is really only that the latter calls unlink, so evidently that's where all the work is. -- Finlay McWalterTalk 16:53, 30 August 2011 (UTC)[reply]
It's probable that unlink() is implemented with a more conservative file-system lock, compared to other operations. You can see that there is much discussion on locking for journaling in ext3 drivers: for example, conversion to unlocked ioctl; Improving ext3 scalability (by removing the Big Kernel Lock). If you want faster, you probably need to get off of ext3: consider using ext2, which is unjournaled (and therefore faster and less safe if your power cuts out during a disk operation). More discussion on improving ext2 in Linux 2.5 from LWN. Nimur (talk) 18:34, 30 August 2011 (UTC)[reply]
Thanks - you're definitely onto something with regard to the journal. I've booted into a livecd and force mounted as ext2. The same clean program, which ran at around 25 deletes per second, is now running at about 160. It's notable that the disk is much quieter - I expect that's because there aren't seeks back and forward to the journal (with, as you say, conservative locking and flushing of that journal). -- Finlay McWalterTalk 21:06, 30 August 2011 (UTC) — Preceding unsigned comment added by 81.174.199.23 (talk) [reply]
unmount the filesystem, run [[debugfs]] on it, and use the debugfs rm command. It'll be operating directly on the block device so it might be faster. You'll have to feed it a separate rm command for each file, but that should be an easy scripting job. Oops, [[debugfs]] links to an article about something else. I'm referring to the debugfs command that comes with e2fsprogs. 67.162.90.113 (talk) 20:05, 30 August 2011 (UTC)[reply]
Thanks, I didn't know about debugfs(8) (or debugfs either, incidentally). As the ext2 mount seems to have made the problem at least tractable I think I'll persevere with it, but I will experiment with debugfs (using my burgeoning collections of stupid filesystem tools) on an unimportant disk (and, as AvrillirvA suggests, nuke it when I'm done). -- 84.93.172.148 (talk) 21:42, 30 August 2011 (UTC) (Finlay McWalter, logged out)[reply]
This is a really interesting experiment. I've thought about doing similar things from time to time. I know some FS are better suited for different file types... I'd always heard that XFS was good for large files while others were good at lots of small files. Investigating the unlinking's interesting. What if you mounted the ext3 as ext2 without the journal (I think this is possible right?)? Do you see any difference in speed then? Seems like the journal should be cached in any case. I'm just speculating... this is interesting though. Shadowjams (talk) 07:05, 31 August 2011 (UTC)[reply]
Back in the good ol' DOS days there was a utility called qdel.com (I think) that always did that sort of thing way faster than del *.* could ever do (if I remember it was instant with thousands of files and with complex tree structures which DOS had problems with). It might be worth it to track this util down and disassemble it to see what it did... since we're on the path of masochistic, pointless things to do with computers! Sandman30s (talk) 16:35, 1 September 2011 (UTC)[reply]

Digital Pens

[edit]

help me in finding the components used in DIGITAL PENs, type of sensors used and the working of DIGITAL PEN — Preceding unsigned comment added by 117.204.7.109 (talk) 15:47, 30 August 2011 (UTC)[reply]

Are you referring to Tag (LeapFrog)? -- kainaw 16:01, 30 August 2011 (UTC)[reply]
Or maybe a digitizing pad or light pen ? StuRat (talk) 21:57, 30 August 2011 (UTC)[reply]

Microsoft Word length

[edit]

Hi. Is there a maximum length or size, either in number of pages or total kilobytes of information that any Microsoft Word document cannot exceed in order to be retrievable or saveable? Does this vary based on the version (2000, '03, '07, etc.)? Is this dependant on presense of images? Thanks. ~AH1 (discuss!) 16:20, 30 August 2011 (UTC)[reply]

It does depend on the version. It's also a little more complicated than "maximum file size," because of the way that modern Word documents are stored. For example, if you insert text, you can place a very very very large amount of it in the document: something like 32-million-character-elements (roughly 2000 pages of solid text). You can also include formatting, content markup, and so on, for a file-size up to 512 megabytes. More complex features, like images, text generated by macros, or content imported as a sub-document, do not count toward these limits do not apply. For a comprehensive listing, see Operating Parameter Limitations and Specifications for Word 2010.
For comparison, here is Operating Parameter Limitations and Specifications for Word '97.
If you are creating Word documents that are arbitrarily large, you should invest some time to learn the advanced features of Microsoft Office: particularly, soft-linking to content in sub-documents: Create a master document and subdocuments. This technique will allow you to create arbitrarily-large documents. Nimur (talk) 18:37, 30 August 2011 (UTC)[reply]
[edit]

Wikipedia.org is one of the world's most popular websites as ranked by Alexa. Wikipedia is managed by a non-profit organization, the Wikimedia Foundation. Most popular websites are owned by for-profit enterprises. What is the second most-popular website owned by a non-profit organization? Is it #202 on Alexa, the Internet Archive? I read the list and did not check every site, but that was the first one that stood out to me. Alexa list Blue Rasberry (talk) 16:57, 30 August 2011 (UTC)[reply]

The BBC is at #39, if you consider that a "non-profit organization". -- Finlay McWalterTalk 17:12, 30 August 2011 (UTC)[reply]

Automatically getting a file's parent directory in Windows 7?

[edit]

In OS X, if I had a PDF open in Adobe Reader, I could Command+Click on the filename at the top of the window, and it would allow me to see its entire file path and quick jump into a Finder window of the directory it is in.

Is there any equivalent in Windows 7? If I have a file open in a program, is there any instant way to know its full file path and open its parent directory? (Other than going to Save As, and then looking for the directory there, then going back into Explorer and navigating to it manually.) --Mr.98 (talk) 18:09, 30 August 2011 (UTC)[reply]

This is really more up to the creators of the application, and not so much Windows. Some programs might do it, but some might not.
In many programs, going to File -> Properties might be an option, which would likely list the file location. TheGrimme (talk) 14:48, 31 August 2011 (UTC)[reply]
In the Save As dialog box you could right click on the current folder (in the directory tree pane) and choose "Open in new window", or press Alt+D to select the directory name in the breadcrumb bar and Ctrl+C to copy it to the clipboard. -- BenRG (talk) 18:24, 31 August 2011 (UTC)[reply]

Home directory physical location when running a Linux Live CD

[edit]

Where does your home directory physically exist when you're running most Linux Live CDs from the CD/DVD drive of your computer, assuming you don't partition any space on your computer's hard drive for it? Are most Live CDs these days on R/W discs and you have space on the disc for leaving stuff, or does your home directory only exist in main memory while you're running the CD (again, assuming you can't touch the HDD) and disappears if you don't save it somewhere before powering down? 20.137.18.50 (talk) 18:55, 30 August 2011 (UTC)[reply]

It varies between distributions! But you can find out! Open a shell and type:
df ~
This will call the df utility program, and tell you the file-system of your home-directory, and the device it is mounted on.
Debian has extensive documentation: initramfs is used for boot-up; some live CD distributions may keep it around for temporary use. Nimur (talk) 19:30, 30 August 2011 (UTC)[reply]
Debian and related distributions (including Knoppix and Ubuntu) use aufs to perform a union mount with a read-only image of the boot media underneath and a writable (but mostly forgotten-on-boot) filesystem in RAM overlaying that. note to self: much generic info in UnionFS should be moved to union mount So most of the time when you read a file you're reading it from the CD, but when you create a file, or change an existing one (even one that exists on the non-writable disk) you're writing into the RAM overlay. Some livecds have a mechanism to write off the home directory to a writable nonvolatile store (usually a flash disk) on logout. By and large, you can't write to a R/W disk randomly or quickly, so it's not suitable for implementing a proper read/write filesystem. -- user:Finlay McWalter (logged out) — Preceding unsigned comment added by 84.93.172.148 (talk) 21:27, 30 August 2011 (UTC)[reply]